package net.cyndeline.fov

/**
 * Calculates which tiles that can be viewed from a specified position
 * on the map, based on a supplied obstacle map.
 */
trait FieldOfViewParser {
  
  /**
   * Computes the field of view based on an obstacle map and a start position.
   * 
   * @param startX X position on the map from where field of view is 
   * 			   being computed.
   * @param startY Y position on the map from where field of view is 
   * 			   being computed.
   * @param obstacleMap 2-dimensional array representing the map in terms of 
   * 					positions that block line-of-sight. Any position with 
   *      				the value 0 indicates that line of sight may be had. 
   *          			1 or higher indicates an obstacle blocking line of 
   *             		sight. Must be rectangular in shape.
   * @param radius The maximum distance (in all directions) that should be 
   * 			   visible from the start position (given no obstacles).
   * @param displayObstacles If set to true, the obstacles that end up blocking 
   * 						 line of sight will be visible as well. This should 
   *        				 be set to true unless you want to hide things 
   *             			 (like walls) blocking sight.
   * @returns All positions in the obstacle map visible from the start position.
   */
  def computedFieldOfView(startX: Int, 
		  				  startY: Int, 
		  				  obstacleMap: Array[Array[Int]], 
		  				  radius: Int,
		  				  displayObstacles: Boolean = true): FieldOfView[(Int, Int)]
}